import Vue from 'vue';
import VueRouter from 'vue-router'
import store from '../store/index'
import { Message } from 'element-ui';

Vue.use(VueRouter)

const routes = [
    {// 登录
        path: '/',
        name: 'Login',
        component: () => import('@/views/login/login.vue')
    },
    {// 首页
        path: '/home/index',
        name: 'index',
        component: () => import ('../views/home/index/index.vue'),
    },
    {// 注册
        path: '/register',
        name: 'register',
        component: () => import ('../views/register/register.vue'),
    },
    {// 实名认证页面
        path: '/home/real-name',
        name: 'RealName',
        component: () => import('@/views/home/real-name/real-name'),
    },
    {// 应急资金基本信息申请
        path: '/home/application-basic-Information',
        name: 'ApplicationBasicInformation',
        component: () => import('@/views/home/application-basic-Information/application-basic-Information'),
    },
    {//应急资金申请信息
        path:'/home/application-information/application-information',
        name: 'ApplicationInformation',
        component:()=>import('@/views/home/application-information/application-information')
    },
    { // 提交申请书1
        path: '/home/submit-material/submit-material-basic',
        name: 'SubmitMaterialBasic',
        component: () => import('@/views/home/submit-material/submit-material-basic/submit-material-basic'),
    },
    { // 提交申请书2
        path: '/home/submit-material/submit-material-corporate',
        name: 'SubmitMaterialCorporate',
        component: () => import('@/views/home/submit-material/submit-material-corporate/submit-material-corporate'),
    },
    { // 提交申请书3
        path: '/home/submit-material/submit-material-finance',
        name: 'SubmitMaterialFinance',
        component: () => import('@/views/home/submit-material/submit-material-finance/submit-material-finance'),
    },
    { //推荐合作机构
        path:'/home/recommend-cooperation-mechanism',
        name:'RecommendCooperationMechanism',
        component: () => import('@/views/home/recommend-cooperation-mechanism/recommend-cooperation-mechanism'),
    },
    { //个人信息
        path:'/home/personal-information',
        name:'personal-information',
        component: () => import('@/views/home/personal-information/personal-information'),
    },
    { // 提交申请书test
        path: '/test',
        component: () => import('@/views/home/submit-material/submit-material-basic/test'),
    },
    { // 提交申请书test
        path: '/application',
        component: () => import('@/views/home/application/application'),
    },
]

const router = new VueRouter({
    routes,
    //使用默认路由模式部署
    // mode: 'history'
})

//路由守卫
// router.beforeEach((to,from,next) => {
//     const token = store.getters('getToken');
//     if (token){
//         next()
//     } else {
//         Message.error("请重新登录")
//         next('/login')
//     }
// })

export default router
